package net.jsoft.platform.security.config.WebSecurity;

import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.boot.web.servlet.ErrorPage;
import org.springframework.context.annotation.Bean;
import org.springframework.http.HttpStatus;

public class EmbeddedServletContainerCustomizerBean
{
    @Bean
    public EmbeddedServletContainerCustomizer containerCustomizer()
    {
        return new EmbeddedServletContainerCustomizer()
        {
            @Override
            public void customize(ConfigurableEmbeddedServletContainer container)
            {
                container.addErrorPages(new ErrorPage(HttpStatus.BAD_REQUEST, "/platform/others/400"));
                container.addErrorPages(new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/platform/others/500"));
                container.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/platform/others/404"));
            }
        };
    }
}
